package com.sjb.cp.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sjb.cp.api.aliyun.model.CreateOutPaintingTaskRequest;
import com.sjb.cp.api.aliyun.model.CreateOutPaintingTaskResponse;
import com.sjb.cp.common.DeleteRequest;
import com.sjb.cp.model.po.Picture;
import com.sjb.cp.model.po.User;
import com.sjb.cp.model.request.picture.*;
import com.sjb.cp.model.vo.PictureVO;
import com.sjb.cp.model.vo.UserLoginVo;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.socket.WebSocketSession;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author dell
 * @description 针对表【picture(图片)】的数据库操作Service
 * @createDate 2024-12-12 14:42:43
 */
public interface PictureService extends IService<Picture> {


    /**
     * @param pictureUploadRequest
     * @return
     */
    PictureVO uploadPicture(Object inputResource,PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 构造查询
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 获取单个图片封装
     * @param picture
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 分页获取图片封装
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    /**
     * 校验图片
     * @param picture
     */
    void validPicture(Picture picture);

    /**
     * 处理图片审核
     * @param pictureReviewRequest
     * @param loginUser
     */
    void doReviewPicture(PictureReviewRequest pictureReviewRequest,User loginUser);

    /**
     * 补充审核参数
     * @param picture
     * @param loginUser
     */
    void fillReviewParams(Picture picture,User loginUser);

    /**
     * 上传图片通过抓取
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return
     */
    Integer uploadPictureByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest,
                                 User loginUser);

    /**
     * 清理图片
     * @param picture
     */
    void clearPictureFile(Picture picture);

    /**
     * 用户图片权限校验
     * @param loginUser
     * @param picture
     */
    void checkPictureAuth(User loginUser,Picture picture);

    /**
     * 删除图片
     * @param deleteRequest
     * @return
     */
    boolean deletePicture(DeleteRequest deleteRequest,HttpServletRequest request);

    /**
     * 编辑图片
     * @param pictureEditRequest
     * @param request
     * @return
     */
    boolean editPicture(PictureEditRequest pictureEditRequest,HttpServletRequest request);

    /**
     * 按照颜色查找图片
     * @param color
     * @param spaceId
     * @param loginUser
     * @return
     */
    List<PictureVO> searchPictureByColor(String color,String spaceId,User loginUser);

    /**
     * 批量编辑图片
     * @param pictureEditByBatchRequest
     * @param request
     */
    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest,HttpServletRequest request);

    /**
     * AI扩图请求类
     * @param outPaintingAIRequest
     * @param loginUser
     * @return
     */
    CreateOutPaintingTaskResponse createOutPaintingTask(OutPaintingAIRequest outPaintingAIRequest,
                                                        User loginUser);
}
